package bairui.international.console.web.controller.advance.category;

/**
 *
 * 添加
 *
 */
abstract class SC_Advance_Category_Add_AddAccess
 extends bairui.international.console.web.controller.C_Common

{
	
	protected bairui.international.console.web.controller.advance.category.Module_Add module_Add = new bairui.international.console.web.controller.advance.category.Module_Add();


	/**
	 * AddAccess
	 */
	@com.lianjing.sh.web.security.authority.SecuredForAction({"ROLE_ROOT"})
	public static final class AddAccess 
	 implements 
		com.lianjing.sh.spring.web.controller.base.action.Actionable 
		,com.lianjing.sh.web.security.authority.Authoritiable
	{

		public static final String Name = "AddAccess";
		public static final String Comment = "访问添加页面";

		public static final String RequestMappingValue = "/advance/category/add{parentId}";
		
		public static com.lianjing.sh.spring.web.controller.base.action.AbstractActionInfoBean Operate(Object parentId){
			return getActionManager().getRequestMappingActionInfoBean(AddAccess.class, parentId);
		}

		/**
		 * 路径变量名
		 */
		public static class PathVariableName {
			public final static String ParentId = "parentId";
		}
		/**
		 * 操作
		 */
		public static com.lianjing.sh.spring.web.controller.base.action.AbstractActionInfoBean OperateVar(AddAccess.Operate variable){
			Object parentId = null;
			if(null != variable){
				parentId = variable.getParentId();
			}
			return Operate(parentId);
		}

		/**
		 * action相关
		 */
		@Override public String name(){
			return AddAccess.Name;
		}
		@Override public String comment(){
			return AddAccess.Comment;
		}
		@Override public String moduleName(){
			return "advanceCategory";
		}
		@Override public String moduleComment(){
			return "产品分类管理";
		}
		@Override public String groupName(){
			return "advance";
		}
		@Override public String groupComment(){
			return "新品预售管理";
		}
		@Override public com.lianjing.sh.spring.web.controller.base.action.AccessType accessType() {
			return com.lianjing.sh.spring.web.controller.base.action.AccessType.General;
		}
		@Override public com.lianjing.sh.spring.web.controller.base.action.ActionType type() {
			return com.lianjing.sh.spring.web.controller.base.action.ActionType.Add;
		}
		/**
		 * 权限相关
		 */
		@Override public String authorityActionName() {
			return "ADD";
		}
		@Override public String authorityActionComment() {
			return "添加";
		}
		@Override public String authorityModuleName() {
			return this.moduleName();
		}
		@Override public String authorityModuleComment() {
			return this.moduleComment();
		}
		@Override public String authorityGroupName() {
			return this.groupName();
		} 
		@Override public String authorityGroupComment() {
			return this.groupComment();
		}

		/**
		 * 参数接口
		 */
		public static abstract class Operate extends com.lianjing.sh.spring.web.controller.base.operate.OperateSupport {
		
			public abstract Object getParentId();
			
		
		
			@Override
			public com.lianjing.sh.spring.web.controller.base.action.AbstractActionInfoBean operate(){
				com.lianjing.sh.spring.web.controller.base.action.AbstractActionInfoBean actionInfoBean = AddAccess.Operate(
						getParentId()
					);
				//
				com.lianjing.sh.spring.web.controller.enhance.navigations.util.Util_Navigations.setUrlSignParameter(actionInfoBean, getRequest(), getActionRequestContext());
				//
				return actionInfoBean;
			}
		
		
			
			/**
			 * 是否显示
			 */
			@Override
			public boolean displaied() {
				/*
				 * 状态相关
				 */
				return true;
			}
		
			/**
			 * 权限
			 */
			@Override
			public boolean granted() {
				com.lianjing.sh.web.security.authority.Authoritiable authoritiable = (com.lianjing.sh.web.security.authority.Authoritiable)this.operate().getActionInfo().getAction();
				java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities = org.springframework.security.core.context.SecurityContextHolder
					.getContext()
					.getAuthentication()
					.getAuthorities();
				//
				boolean hasAuthority =
					authorities.contains(new org.springframework.security.core.authority.SimpleGrantedAuthority(
							(authoritiable.authorityGroupName() + "_" + authoritiable.authorityModuleName() + "_" + authoritiable.authorityActionName()).toUpperCase()
						));
				//
				com.lianjing.sh.web.security.authority.SecuredForAction ann = authoritiable.getClass().getAnnotation(com.lianjing.sh.web.security.authority.SecuredForAction.class);
				if(null != ann){
					for(String item : ann.value()){
						hasAuthority |= authorities.contains(new org.springframework.security.core.authority.SimpleGrantedAuthority(item.toUpperCase()));
					}
				}
				return hasAuthority;
			}
		
		}
		


		

		

	}

}
